/*
 * @Author: Njpyy
 * @Date: 2024-03-16 23:14:48
 * @LastEditors: Njpyy
 * @LastEditTime: 2024-03-17 17:47:26
 * @FilePath: /big-event/src/api/article.js
 * @Description: 
 */
import request from '@/utils/request'
// import { useTokenStore } from '@/store/token'

// const tokenStore = useTokenStore()

//文章分类列表查询
export const articleCategoryListService = () => {
    //获取token
    // const tokenStore = useTokenStore() //这里不能写在外面，否则会报错
    // const token = tokenStore.token
    //在pinia中定义的响应式数据都不需要.value
    // return request.get('/category/list', { headers: { 'Authorization': token } })
    return request.get('/category/list')
}

//添加文章分类-(application/json)
export const articleCategoryAddService = (categoryData) => {
    return request.post('/category/add', categoryData)
}

//编辑文章分类-(application/json)
export const articleCategoryEditService = (categoryData) => {
    return request.put('/category/update', categoryData)
}


//删除文章分类-(queryString)-单个参数
export const articleCategoryDeleteService = (id) => {
    return request.delete('/category/delete?id=' + id)
}

//文章列表分页查询-(queryString)-多个参数
export const articleListService = (params) => {
    return request.get('/article/list', { params })
}

//添加文章-(application/json)
export const articleAddService = (articleData) => {
    return request.post('/article/add', articleData)
}